package demo.yml;

import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.Constructor;

/**
 * 自定义yml标签解析
 */
public class YmlParser {

    public static void main(String[] args) {
        Constructor construct = new CustomConstructor();
        Yaml yaml = new Yaml(construct);
        //读取classpath下面的application.yml文件
        Object obj = yaml.load(YmlParser.class.getClassLoader().getResourceAsStream("application.yml"));
        System.out.println(obj);
    }

}
